<HTML><HEAD><TITLE>if(+Goal)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Directives</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>if(+Goal)</H1>
Conditional compilation directive.
<DL>
<DT><EM>Goal</EM></DT>
<DD>Goal to be tested
</DD>
</DL>
<H2>Description</H2>
<P>
    The compiler and other source-processing tools recognise the conditional
    compilation directives if/1, elif/1, else/0 and endif/0. The first two
    take a goal as their argument, and parts of the program source can be
    included or excluded depending of the satisfiability of that goal.
<P>
    Note that these directives are the only ones that are not treated as
    predicate separators and can be placed around individual clauses of
    a predicate.
    
<H3>Modes and Determinism</H3><UL>
<LI>if(+) is det
</UL>
<H2>Examples</H2>
<PRE>
    :- if(get_flag(hostarch,"i386_nt")).

	...Windows-specific code...

    :- elif( (get_flag(version_as_list,Version), Version @&gt;= [6,0]) ).

	...code for version 6.0 and later...

    :- else.

	...alternative code...

    :- endif.
    </PRE>
<H2>See Also</H2>
<A HREF="../../kernel/directives/elif-1.html">elif / 1</A>, <A HREF="../../kernel/directives/else-0.html">else / 0</A>, <A HREF="../../kernel/directives/endif-0.html">endif / 0</A>, <A HREF="../../lib/source_processor/index.html">library(source_processor)</A>
</BODY></HTML>
